<script src="/javascripts/jquery.jeditable.js" type="text/javascript"></script>
<script src="/javascripts/in_line_edit.js" type="text/javascript"></script>
<%= javascript_include_tag 'admin_table.js' %>



<div id='breadcrumb'>
  <a href="/">首页</a>&gt;类别列表
</div>

<table class="admin">
  <thead>
    <tr>
      <th>父类</th>
      <th>名称</th>
      <th>单位</th>
      <th>导航可见</th>
      <th>可用</th>
      <th colspan="3"></th>
    </tr>
  </thead>
  <% for category in @categories %>
    <tr>
      <td>
        <div class="edit_parent"  id="<%=category.id%>">
          <%=h category.parent ? truncate(category.parent.name,10) : "顶级"  %>
        </div>
      </td>
      <td><div class="edit_name"  id="<%=category.id%>"><%=h category.name %></div></td>
      <td><div class="edit_unit"  id="<%=category.id%>"><%=format_unit category.unit.to_s  if category.unit %></div></td>
      <td><%=format_boolean(category.show_in_nav) %></td>
      <td><%=format_boolean category.active %></td>
      <td><%= link_to '查看', category %></td>
      <td><%= link_to '编辑', edit_category_path(category) %></td>
      <td><%= link_to '删除', category, :confirm => '你确定?', :method => :delete %></td>
    </tr>
  <% end %>


</table>
<%= will_paginate @categories,:prev_label => '«上一页',:next_label => '下一页»' %>
<br />
<div style=""display:none id='hidden_form'>
  <%= form_tag('/categories')  %>
</div>
<%= link_to '新增', new_category_path %>
